package com.zhangyu.shadow.core.app;

import android.content.Context;
import android.os.Handler;


/**
 * @author zhangyu
 * @date 2017/10/18
 */
public final class Shadow {
    public static Configurator init(Context context) {
        getConfigurator().getShadowConfigs().put(ConfigType.APPLICATION_CONTEXT, context.getApplicationContext());
        return Configurator.getInstance();
    }

    public static Configurator getConfigurator() {
        return Configurator.getInstance();
    }

    public static <T> T getConfiguration(Object key) {
        return getConfigurator().getConfiguration(key);
    }

    public static Context getApplication() {
        return (Context) getConfiguration(ConfigType.APPLICATION_CONTEXT);
    }

    public static Handler getHandler() {
        return getConfiguration(ConfigType.HANDLER);
    }
}
